<?php
function reg_student($user, $name, $contact, $email,$course, $address, $gender, $date, $month, $year){
	$add="INSERT INTO user (`user`,`pass`, `name`, `contact`, `email`,`picture`) VALUES ('$user', '$user', '$name', '$contact', '$email','fbpics.jpg')";
	$a=mysql_query($add) or die ('ERROR:' .mysql_error());
	return $a >=1 ? TRUE: FALSE;
}
function pending_reg($user, $name, $contact, $email,$course, $address, $gender, $date, $month, $year){
	$add="INSERT INTO pending (`user`,`pass`, `name`, `contact`, `email`,`course`, `address`, `gender`, `date`,`month`,`year`,`picture`) VALUES ('$user', '$user', '$name', '$contact', '$email','$course', '$address', '$gender', '$date','$month', '$year','fbpics.jpg')";
	$a=mysql_query($add) or die ('ERROR:' .mysql_error());
	return $a >=1 ? TRUE: FALSE;
}

function verify_student($user){
	$verify="SELECT * FROM user WHERE user='$user'";
	$b=mysql_query($verify) or die ('ERROR:' .mysql_error());
	return mysql_num_rows($b) >=1 ? TRUE : FALSE; 
}
function verify_email($email){
	$verify="SELECT * FROM user WHERE email='$email'";
	$b=mysql_query($verify) or die ('ERROR:' .mysql_error());
	return mysql_num_rows($b) >=1 ? TRUE : FALSE; 
}
function verify_contact($contact){
	$verify="SELECT * FROM user WHERE contact='$contact'";
	$b=mysql_query($verify) or die ('ERROR:' .mysql_error());
	return mysql_num_rows($b) >=1 ? TRUE : FALSE; 
}
function verify_pending($user, $name, $contact, $email,$course, $address, $gender, $date, $month, $year){
	$insert="INSERT INTO user (`user`,`pass`, `name`, `contact`, `email`,`course`, `address`, `gender`, `date`,`month`,`year`,`picture`) VALUES ('$user', '$user', '$name', '$contact', '$email','$course', '$address', '$gender', '$date','$month', '$year','fbpics.jpg')";
	$pending=mysql_query($insert) or die('ERROR'.mysql_error());
	return $pending >=1 ? TRUE: FALSE;
}
function select_pending(){
	$select="SELECT * FROM pending";
	$result=mysql_query($select) or die('ERROR'.mysql_error());
	$results=array();
		if(mysql_num_rows($result)>=1){
			while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
				$results[]=$row;
			}
			return $results;
		}
		else
		return 0;
}

?>